# -*- coding:utf-8 -*-
# @Time:2024/4/1921:01
# @Author:miuzg
# @FileName:new test2.py
# @Software:PyCharm
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

driver = webdriver.Edge()
driver.get('https://www.baidu.com/')

# 隐式等待，等十秒，如果有了数据就获取，过了十秒还是没数据就抛出异常
# driver.implicitly_wait(10)

# 显式等待
WebDriverWait(driver,20).until(
    # 页面加载出 '地图'内容出现后，就执行后续操作
    EC.presence_of_element_located((By.LINK_TEXT,'地图'))
)

input()
driver.quit()